﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;

namespace AdvanceLib.UI.Controls
{
    [DefaultEvent("Paint")]
    public class Panel : BasePanel
    {
        #region Constructors
        public Panel()
        {
            this.Paint += new System.Windows.Forms.PaintEventHandler(Panel_Paint);

            this.BackColor = Color.Transparent;
        }
        #endregion

        #region Event Handlers
        void Panel_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            RenderEngine.Graphics = e.Graphics;

            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            RenderEngine.RenderBorderRadius(Brushes.White, new Rectangle(5, 5, this.Width - 1 - 5 * 2, this.Height - 1 - 5 * 2), 8);

            RenderEngine.RenderBorderRadius(
                new LinearGradientBrush(
                    new Rectangle(5, 5, this.Width - 1 - 5 * 2, this.Height - 1 - 5 * 2),
                    Color.FromArgb(0, Color.Black), Color.FromArgb(15, Color.Black), 90),
                    new Rectangle(5, 5, this.Width - 1 - 5 * 2, this.Height - 1 - 5 * 2),
                    8);

            RenderEngine.RenderBorderRadius(new Pen(Color.FromArgb(65, Color.Black)), new Rectangle(5, 5, this.Width - 1 - 5 * 2, this.Height - 1 - 5 * 2), 8);
            RenderEngine.RenderBorderRadius(Pens.White, new Rectangle(5 + 1, 5 + 1, this.Width - 3 - 5 * 2, this.Height - 3 - 5 * 2), 8);

            for (int i = 0; i < 5; i++)
            {
                RenderEngine.RenderBorderRadius(
                    new Pen(Color.FromArgb(Math.Min((i * 6), 255), Color.Black)),
                    new Rectangle(i, i, this.Width - 1 - i * 2, this.Height - 1 - i * 2), 9 + i);
            }
        }
        #endregion
    }
}
